package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


@Entity
@Table(name = "bjdacp_resend_lic_log")
public class ResendLicLog extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "换证记录";
	public static final String ALIAS_BJDACP_RESEND_LIC_LOG_ID = "bjdacpResendLicLogId";
	public static final String ALIAS_DRUG_SELL_UNIT_ID = "drugSellUnitId";
	public static final String ALIAS_LIC_CODE = "证号";
	public static final String ALIAS_LIC_GIVE_DATE = "证件发放日期";
	public static final String ALIAS_LIC_EXPIRY_DATE = "证件有效日期";
	public static final String ALIAS_LIC_TYPE = "证件类型";
	public static final String ALIAS_RESEND_DATE = "换证时间";

	//date formats
	public static final String FORMAT_LIC_GIVE_DATE = DATE_FORMAT;
	public static final String FORMAT_LIC_EXPIRY_DATE = DATE_FORMAT;
	public static final String FORMAT_RESEND_DATE = DATE_FORMAT;


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * bjdacpResendLicLogId       db_column: bjdacp_resend_lic_log_id
     */
	
	private java.lang.Integer bjdacpResendLicLogId;
    /**
     * drugSellUnitId       db_column: drug_sell_unit_id
     */
	
	private java.lang.Integer drugSellUnitId;
    /**
     * 证号       db_column: lic_code
     */
	@Length(max=200)
	private java.lang.String licCode;
    /**
     * 证件发放日期       db_column: lic_give_date
     */
	
	private java.util.Date licGiveDate;
    /**
     * 证件有效日期       db_column: lic_expiry_date
     */
	
	private java.util.Date licExpiryDate;
    /**
     * 证件类型       db_column: lic_type
     */
	@Length(max=200)
	private java.lang.String licType;
    /**
     * 换证时间       db_column: resend_date
     */
	
	private java.util.Date resendDate;
	//columns END


	public ResendLicLog(){
	}

	public ResendLicLog(
		java.lang.Integer bjdacpResendLicLogId
	){
		this.bjdacpResendLicLogId = bjdacpResendLicLogId;
	}



	public void setBjdacpResendLicLogId(java.lang.Integer value) {
		this.bjdacpResendLicLogId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "bjdacp_resend_lic_log_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getBjdacpResendLicLogId() {
		return this.bjdacpResendLicLogId;
	}

	@Column(name = "drug_sell_unit_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getDrugSellUnitId() {
		return this.drugSellUnitId;
	}

	public void setDrugSellUnitId(java.lang.Integer value) {
		this.drugSellUnitId = value;
	}

	@Column(name = "lic_code", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getLicCode() {
		return this.licCode;
	}

	public void setLicCode(java.lang.String value) {
		this.licCode = value;
	}

	@Transient
	public String getLicGiveDateString() {
		return DateConvertUtils.format(getLicGiveDate(), FORMAT_LIC_GIVE_DATE);
	}
	public void setLicGiveDateString(String value) {
		setLicGiveDate(DateConvertUtils.parse(value, FORMAT_LIC_GIVE_DATE,java.util.Date.class));
	}

	@Column(name = "lic_give_date", unique = false, nullable = true, insertable = true, updatable = true, length = 23)
	public java.util.Date getLicGiveDate() {
		return this.licGiveDate;
	}

	public void setLicGiveDate(java.util.Date value) {
		this.licGiveDate = value;
	}

	@Transient
	public String getLicExpiryDateString() {
		return DateConvertUtils.format(getLicExpiryDate(), FORMAT_LIC_EXPIRY_DATE);
	}
	public void setLicExpiryDateString(String value) {
		setLicExpiryDate(DateConvertUtils.parse(value, FORMAT_LIC_EXPIRY_DATE,java.util.Date.class));
	}

	@Column(name = "lic_expiry_date", unique = false, nullable = true, insertable = true, updatable = true, length = 23)
	public java.util.Date getLicExpiryDate() {
		return this.licExpiryDate;
	}

	public void setLicExpiryDate(java.util.Date value) {
		this.licExpiryDate = value;
	}

	@Column(name = "lic_type", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getLicType() {
		return this.licType;
	}

	public void setLicType(java.lang.String value) {
		this.licType = value;
	}

	@Transient
	public String getResendDateString() {
		return DateConvertUtils.format(getResendDate(), FORMAT_RESEND_DATE);
	}
	public void setResendDateString(String value) {
		setResendDate(DateConvertUtils.parse(value, FORMAT_RESEND_DATE,java.util.Date.class));
	}

	@Column(name = "resend_date", unique = false, nullable = true, insertable = true, updatable = true, length = 23)
	public java.util.Date getResendDate() {
		return this.resendDate;
	}

	public void setResendDate(java.util.Date value) {
		this.resendDate = value;
	}


	private DrugSellUnit drugSellUnit;
	public void setDrugSellUnit(DrugSellUnit drugSellUnit){
		this.drugSellUnit = drugSellUnit;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "drug_sell_unit_id",nullable = false, insertable = false, updatable = false) 
	})
	public DrugSellUnit getDrugSellUnit() {
		return drugSellUnit;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("BjdacpResendLicLogId",getBjdacpResendLicLogId())
			.append("DrugSellUnitId",getDrugSellUnitId())
			.append("LicCode",getLicCode())
			.append("LicGiveDate",getLicGiveDate())
			.append("LicExpiryDate",getLicExpiryDate())
			.append("LicType",getLicType())
			.append("ResendDate",getResendDate())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getBjdacpResendLicLogId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof ResendLicLog == false) return false;
		if(this == obj) return true;
		ResendLicLog other = (ResendLicLog)obj;
		return new EqualsBuilder()
			.append(getBjdacpResendLicLogId(),other.getBjdacpResendLicLogId())
			.isEquals();
	}
}

